
Ext.onReady(function(){
        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());   
		   var classClicked = function(e, target){
			Ext.get('center1').dom.src=target.href;
		};
	   var treePanel = new Ext.tree.TreePanel({
			id: 'tree-panel',
			title: 'Menu de Opciones',
			region:'north',
            iconCls:'icon-option',
			split: true,
			height: 500,
			minSize: 50,
			autoScroll: true,
			rootVisible: false,
			lines: true,
			singleExpand: false,
			useArrows: true,
            bbar: [
                    new Ext.Action({
                        text: 'Expandir',
                        tooltip:'Expandir todo',
                        ctCls: 'button-action',
                        iconCls: 'icon-up',
                        handler: function(){
                            treePanel.root.expand(true);
                        }
                    }),
                    new Ext.Action({
                        text: 'Contraer',
                        tooltip:'Contraer todo',
                        ctCls: 'button-action',
                        iconCls: 'icon-down',
                        handler: function(){
                            treePanel.root.collapse(true);
                        }
                    })
                ],            
			loader: new Ext.tree.TreeLoader({
				dataUrl:'js/ext/treeView/treeJson.jsp?cusername='+document.formLogin.logincusro_codigo.value+"&app="+document.formLogin.app.value
			}),
			root: new Ext.tree.AsyncTreeNode()
		});
		treePanel.on('click', function(n){
                    if(n.isLeaf()){
                         Ext.get('center1').dom.src = n.id;
                    }
		});
       var viewport = new Ext.Viewport({
            layout:'border',
            items:[
                new Ext.BoxComponent({ 
                    region:'north',
                    el: 'north',
                    height:32
                    
                }), /*{
                    region:'east',
                    title: 'Informe',
					closable:true,
                    collapsible: true,
                    split:true,
                    width: 225,
                    minSize:80,
                    maxSize: 400,
                    layout:'fit',
                    margins:'0 5 0 0',
                    items:
                        new Ext.TabPanel({
                            border:false,
                            activeTab:0,
                            tabPosition:'bottom',
                            items:[{
                                html:'',
                                title: 'Informe',
                                autoScroll:true
                            }]
                        })
                 },*/{
                    region:'west',
                    id:'west-panel',
                    title:'Explorador',
                    split:true,
                    width: 200,
                    minSize:50,
                    maxSize: 400,
                    collapsible: true,
                    margins:'0 0 0 5',
                    layout:'accordion',
                    layoutConfig:{
                        animate:true
                    },
                    items: [treePanel,{
                        title:'Ayuda',
                        html:'<a href="manual.pdf" target="center1">Manual</a>',
                        border:false,
                        iconCls:'icon-help'
                    }]
                },
                new Ext.TabPanel({
                    region:'center',
                    deferredRender:false,
                    activeTab:0,
                    items:[{
                        contentEl:'center1',
                        title: 'Contenido',
                        iconCls: 'icon-content',
                        closable:false,
                        autoScroll:true
                    }]
                })
             ]
        });
	    Ext.get('center1').dom.width="100%";
		Ext.get('center1').dom.height="100%";
        Ext.get('center1').dom.src = "bienvenida.html";
        treePanel.root.expand(true);
    });
